<?php
class Default_Form_Item extends Zend_Form
{

    public function init()
    {
        $this->setName("item");
        $this->setAttrib('enctype','multipart/form-data');
        
        $itemId = new Zend_Form_Element_Text('itemId');
        $itemId->setLabel('Mã item')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
        $itemId->setAttrib('size', 60);
        
        $itemName = new Zend_Form_Element_Text('itemName');
        $itemName->setLabel('Tên item')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
        $itemName->setAttrib('size', 60);
        
        $itemImg = new Zend_Form_Element_File('itemImg');
        $itemImg->setLabel('Hình ảnh');
        $itemImg->addValidator('Extension',true,array('jpg','gif','png'),'picture');
        $itemImg->addValidator('Size',true,array('min'=>'10KB','max'=>'2000KB'),'filezip'); 
        $itemImg->setAttrib('size', 60);
        
        $itemCost = new Zend_Form_Element_Text('itemCost');
        $itemCost->setLabel('Giá item')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
        $itemCost->setAttrib('size', 60);
        
        $itemFlag = new Zend_Form_Element_Select('itemFlag');
        $itemFlag->setLabel('Loại tiền');
        $itemFlag->addMultiOption('Vàng','Vàng');
        $itemFlag->addMultiOption('Kim phiếu','Kim phiếu');
        $itemFlag->addMultiOption('Vàng + Kim phiếu','Vàng + Kim phiếu');
        
        // submit button
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setAttrib('id','submitbutton');
        $submit->setAttrib('class',"button medium");
                
        // add elements to form
        $this->addElements(array (
            $itemId, $itemName, $itemCost, $itemFlag, $submit
        ));
    }
}

